Ext.define('User', {
    extend: 'Ext.data.Model',
    fields: [
        'id', 'username', 'email', 'mobile', 'permissions'
    ]
});
Ext.define('Grails.security.User', {
    extend: 'Grails.plugin.GrailsApp',

    gridTitle: '用户管理',
    formTitle: '用户编辑',

    listUrl: '/GoIndustry/user/list',
	deleteUrl: '/GoIndustry/user/delete/',
//	editUrl: '/GoIndustry/admin/user.json',
	editUrl: '/GoIndustry/user/edit/',
	saveUrl: '/GoIndustry/user/save',
    modelName:'User',

	 constructor: function(config) {
         this.callParent(config);
         return this;

     },

	getGridFields:function(){
		return [
            'id', 'username', 'email', 'mobile', 'permissions'
        ];
	},
	
	getGridColumns:function(){
		return [{
            text: "用户名",
            dataIndex: 'username'
        }, {
            text: "电子邮件",
            dataIndex: 'email'
        }, {
            text: "手机号码",
            dataIndex: 'mobile'
        }, {
            text: "permissions",
            dataIndex: 'permissions',
            flex: 1
        }];
	},


    getFormFields:function(){
//        return [
//            {name: 'first', mapping: 'name > first'},
//            {name: 'last', mapping: 'name > last'},
//            'company', 'email', 'state',
//            {name: 'dob', type: 'date', dateFormat: 'm/d/Y'}
//        ]
        return [{name:'id'}, {name:'username'}, {name:'email'}, {name:'mobile'}];
    },
	createFormItems: function(){
        return [
            {
                fieldLabel:'用 户 名',
                name:'username',
                allowBlank:false
            },
            {
                fieldLabel:'密　　码',
                type:'password',
                name:'password'
            },
            {
                fieldLabel:'电子邮件',
                vtype:'email',
                name:'email'
            },
            {
                fieldLabel:'手机号码',
                vtype:'',
                name:'mobile'
            }
        ];
	 }
})
